import logging

import requests


class TestA3mall():
    userId=""
    sessionId=""
    movieId=""
    cinemaId=""
    paiqiId=""
    def setup_method(self):
        print("开始执行测试用例...")
        logging.info("开始执行测试用例...")
    def teard_method(self):
        print("用例执行结束...")
        logging.info("用例执行结束")
    def test_login(self):
        try:
            url="http://10.59.9.12:7001/api/public/login"
            data={"username":"13811033962","password":"123456"}
            r=requests.post(url=url,data=data)
            print(r.json())
        except Exception as e:
            print(e)
        assert r.json()["data"]["id"]==6
        assert r.status_code==200
        assert "会员" in r.text
        TestA3mall.userId="Bearer "+r.json()['data']['token']
    def test_login1(self):
        url="http://10.59.9.12:7001/api/order/detail"
        data={"id":"224299"}
        he={"auth-token":TestA3mall.userId}
        r=requests.post(url=url,params=data,headers=he)
        print(r.json())
    def test_queren(self):
        url = "http://10.59.9.12:7001/api/order/detail"
        data = {"id":"224299"}
        he = {"content-type":"application/json","Auth-Token":TestA3mall.userId}
        r = requests.post(url=url, json=data, headers=he)
        print(r.json())